<body><form>
<select multiple size=5 onchange="change()"><option>1</option><option>2</option></select>
</form>
<div id=res></div>
<script>

var select = document.forms[0].elements[0];
var res = document.getElementById("res");
select.focus();
if (window.testRunner) {
    testRunner.dumpAsText();
    eventSender.keyDown("ArrowDown", []);
    eventSender.keyDown("ArrowDown", ["shiftKey"]);
} else {
    res.textContent = "Press down arrow.";
}

function change() {
    if (select.firstChild.selected && !select.firstChild.nextSibling.selected) {
        select.appendChild(new Option("3", "3", false, false));
        res.textContent = "Press shift + down arrow.";
    } else if (select.firstChild.selected && select.firstChild.nextSibling.selected && !select.lastChild.selected)
        res.textContent = "Success.";
    else
        res.textContent = "Failed.";
}
</script>
